package com.hyl.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author hyl
 * @description
 * @create 2025-06-06 17:54
 */
@Configuration
@EnableConfigurationProperties(AlipayConfigproperties.class)
public class AliPayConfig {
    @Bean("alipayClient")
    public AlipayClient ailpayClient(AlipayConfigproperties properties){
        return new DefaultAlipayClient(
                properties.getGatewayUrl(),
                properties.getApp_id(),
                properties.getMerchant_private_key(),
                properties.getFormat(),
                properties.getCharset(),
                properties.getAlipay_public_key(),
                properties.getSign_type());
    }

}
